﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="main.aspx.cs" Inherits="base_main" %>

// JScript 文件
var baseUrl="<%= Params.RootHttp %>";
var ActionPageUrl=baseUrl+"base/action.aspx";
var PacePageUrl=baseUrl+"base/pace.aspx";
$(document).ready(function() {
	// use this to reset a single form
	if($("#divSystemMessage").text()!="")
	{
	    $("#divSystemMessage").show('slow');
	}
	$("#divSystemMessage").click(function(){
	    $(this).hide('slow');
	});
});

function Login(username,password,key,url,FunExec)
{
    var md5value=MD5(key+password);
    var u=url+"?username"+encodeURI(username)+"&password"+encodeURI(md5value)+"&RandomNum="+Math.random();
    send_request("get",u,null,"text",FunExec);
}

function ICB()
{
    if(http_request.readyState==4)
    {
        if(http_request.status==200)
        {
            return true;
        }
        else
        {
            alert("请求发生错误！");
            return false;
        }
    }
    else
    {
        return false;
    }
}

function LoginCallBack()
{
	if(ICB())
	{
		var s=http_request.responseText;
		if(s=="failed")
		{
			var t1=document.getElementById("innerTD1");
			t1.innerHTML="报名库尚未上传，请先行上传再导入！";
			SetT2();
		}
		else
		{
			MyIntervalID=window.setInterval(GetBmkDRInfo,1000);
		}
	}
}

function TriggerFunc(funcname,params,func)
{
    var url=ActionPageUrl+"?func="+funcname;
    var c=count(params);
    var p="";
    for(var i=0;i<c;i++)
    {
        p=p+"&"+"param"+i+"="+params[i];
    }
    url=url+p;
    send_request("get",url,null,"text",func);
}

function PaceOn(type,action,func)
{
    var url=PacePageUrl+"?type"+type+"&action="+action;
    send_request("get",url,null,"text",func);
}

function AjaxCallBack()
{
	if(ICB())
	{
		var s=http_request.responseText;
		return s;
	}
	else
	{
	    return null;
	}
}

function DelFile(fileID,divID)
{
    var url=baseUrl+"base/DelFile.aspx?FileID="+fileID+"&DivID="+divID;
    send_request("get",url,null,"text",DelFileCallBack);
}


function DelFileCallBack()
{
    var divID=AjaxCallBack();
    if(divID==null)
    {
        return;
    }
    if(divID=="fail")
    {
        alert("删除失败！");
        return;
    }
    var d=document.getElementById(divID);
    if(d==null)
    {
        alert("删除失败！");
        return;
    }
    alert("删除成功！");
    d.style.display="none";
}

function EnableFileUp(divID,obj)
{
    var d=document.getElementById(divID);
    if(d.style.display=="none")
    {
        d.style.display="block";
        obj.innerHTML="折叠";
    }
    else
    {
        d.style.display="none";
        obj.innerHTML="上传附件";
    }
}